/*
 * GuudButton.h
 *
 *  Created on: 2013-1-25
 *      Author: heqiu
 */

#ifndef GUUDBUTTON_H_
#define GUUDBUTTON_H_

#include "GuudPoint.h"
#include "GuudSurface.h"
#include "GuudListener.h"
#include <string>

namespace guud {

typedef enum _GuudButtonStatus {
	GUUD_BUTTON_STATUS_OUT = 1,
	GUUD_BUTTON_STATUS_IN = 2,
	GUUD_BUTTON_STATUS_PRESSED = 3,
} GuudButtonStatus;

class GuudButton {
public:
	bool m_bShow;
	bool m_bListen;
	GuudSurface * m_pGuudSurface;
	GuudRect m_rectIn;
	GuudRect m_rectOut;
	GuudRect m_rectPressed;
	GuudButtonStatus m_status;
	std::string m_sName;

	GuudButton();
	GuudButton(const GuudButton & obj);
	void setSurface(GuudSurface * pSurface, GuudRect & rectIn,
			GuudRect & rectOut, GuudRect & rectPressed);
	void handleEvent(GuudPoint & stPoint, GuudEvent & stEvent, void * pData);
	void setFuncPressed(void (*func_pressed)(void *, GuudButton *));
private:
	bool bPointIn(int32_t iX, int32_t iY);
	void (*m_func_pressed)(void *, GuudButton * pButton);
};

}

#endif /* GUUDBUTTON_H_ */
